.class public Lcom/instagram/android/feed/a/a/d;
.super Landroid/database/DataSetObserver;
.source "FeedItemViewableHelper.java"


# instance fields
.field private final a:Lcom/instagram/android/feed/a/a;

.field private final b:Landroid/os/Handler;

.field private final c:I

.field private d:Ljava/util/Set;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Set",
            "<",
            "Lcom/instagram/android/feed/a/a/f;",
            ">;"
        }
    .end annotation
.end field

.field private e:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Lcom/instagram/j/l;",
            ">;"
        }
    .end annotation
.end field

.field private f:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Lcom/instagram/j/l;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>(Lcom/instagram/android/feed/a/a;Landroid/util/DisplayMetrics;)V
    .locals 2
    .parameter
    .parameter

    .prologue
    .line 36
    invoke-direct {p0}, Landroid/database/DataSetObserver;-><init>()V

    .line 30
    new-instance v0, Ljava/util/HashSet;

    invoke-direct {v0}, Ljava/util/HashSet;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/feed/a/a/d;->d:Ljava/util/Set;

    .line 32
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/feed/a/a/d;->e:Ljava/util/Map;

    .line 34
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/feed/a/a/d;->f:Ljava/util/Map;

    .line 37
    iput-object p1, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    .line 38
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/feed/a/a/d;->b:Landroid/os/Handler;

    .line 40
    const/high16 v0, 0x4320

    iget v1, p2, Landroid/util/DisplayMetrics;->density:F

    mul-float/2addr v0, v1

    const/high16 v1, 0x3f00

    add-float/2addr v0, v1

    float-to-int v0, v0

    iput v0, p0, Lcom/instagram/android/feed/a/a/d;->c:I

    .line 41
    return-void
.end method

.method private a(Landroid/view/View;)I
    .locals 7
    .parameter

    .prologue
    const/4 v0, 0x0

    .line 194
    new-instance v1, Landroid/graphics/Rect;

    iget-object v2, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v2}, Lcom/instagram/android/feed/a/a;->e()Landroid/widget/ListView;

    move-result-object v2

    invoke-virtual {v2}, Landroid/widget/ListView;->getWidth()I

    move-result v2

    iget-object v3, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v3}, Lcom/instagram/android/feed/a/a;->e()Landroid/widget/ListView;

    move-result-object v3

    invoke-virtual {v3}, Landroid/widget/ListView;->getHeight()I

    move-result v3

    invoke-direct {v1, v0, v0, v2, v3}, Landroid/graphics/Rect;-><init>(IIII)V

    .line 199
    new-instance v2, Landroid/graphics/Rect;

    invoke-virtual {p1}, Landroid/view/View;->getLeft()I

    move-result v3

    invoke-virtual {p1}, Landroid/view/View;->getTop()I

    move-result v4

    invoke-virtual {p1}, Landroid/view/View;->getRight()I

    move-result v5

    invoke-virtual {p1}, Landroid/view/View;->getBottom()I

    move-result v6

    invoke-direct {v2, v3, v4, v5, v6}, Landroid/graphics/Rect;-><init>(IIII)V

    .line 204
    new-instance v3, Landroid/graphics/Rect;

    invoke-direct {v3}, Landroid/graphics/Rect;-><init>()V

    .line 205
    invoke-virtual {v3, v1, v2}, Landroid/graphics/Rect;->setIntersect(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z

    move-result v1

    .line 207
    if-nez v1, :cond_0

    .line 211
    :goto_0
    return v0

    :cond_0
    iget v0, v3, Landroid/graphics/Rect;->bottom:I

    iget v1, v3, Landroid/graphics/Rect;->top:I

    sub-int/2addr v0, v1

    goto :goto_0
.end method

.method static synthetic a(Lcom/instagram/android/feed/a/a/d;)Lcom/instagram/android/feed/a/a;
    .locals 1
    .parameter

    .prologue
    .line 21
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    return-object v0
.end method

.method private a(Lcom/instagram/j/l;)V
    .locals 2
    .parameter

    .prologue
    .line 158
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->d:Ljava/util/Set;

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/android/feed/a/a/f;

    .line 159
    invoke-interface {v0, p1}, Lcom/instagram/android/feed/a/a/f;->a(Lcom/instagram/j/l;)V

    goto :goto_0

    .line 161
    :cond_0
    return-void
.end method

.method private a(Lcom/instagram/j/l;I)V
    .locals 2
    .parameter
    .parameter

    .prologue
    .line 152
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->d:Ljava/util/Set;

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/android/feed/a/a/f;

    .line 153
    invoke-interface {v0, p1, p2}, Lcom/instagram/android/feed/a/a/f;->a(Lcom/instagram/j/l;I)V

    goto :goto_0

    .line 155
    :cond_0
    return-void
.end method

.method private a(I)Z
    .locals 1
    .parameter

    .prologue
    .line 176
    if-eqz p1, :cond_0

    const/4 v0, 0x3

    if-ne p1, v0, :cond_1

    :cond_0
    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method static synthetic b(Lcom/instagram/android/feed/a/a/d;)V
    .locals 0
    .parameter

    .prologue
    .line 21
    invoke-direct {p0}, Lcom/instagram/android/feed/a/a/d;->e()V

    return-void
.end method

.method private b(Lcom/instagram/j/l;)V
    .locals 2
    .parameter

    .prologue
    .line 170
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->d:Ljava/util/Set;

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/android/feed/a/a/f;

    .line 171
    invoke-interface {v0, p1}, Lcom/instagram/android/feed/a/a/f;->b(Lcom/instagram/j/l;)V

    goto :goto_0

    .line 173
    :cond_0
    return-void
.end method

.method private b(Lcom/instagram/j/l;I)V
    .locals 2
    .parameter
    .parameter

    .prologue
    .line 164
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->d:Ljava/util/Set;

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/android/feed/a/a/f;

    .line 165
    invoke-interface {v0, p1, p2}, Lcom/instagram/android/feed/a/a/f;->b(Lcom/instagram/j/l;I)V

    goto :goto_0

    .line 167
    :cond_0
    return-void
.end method

.method private b(I)Z
    .locals 1
    .parameter

    .prologue
    .line 181
    const/4 v0, 0x3

    if-ne p1, v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method private c()V
    .locals 2

    .prologue
    .line 54
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->b:Landroid/os/Handler;

    new-instance v1, Lcom/instagram/android/feed/a/a/e;

    invoke-direct {v1, p0}, Lcom/instagram/android/feed/a/a/e;-><init>(Lcom/instagram/android/feed/a/a/d;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 63
    return-void
.end method

.method static synthetic c(Lcom/instagram/android/feed/a/a/d;)V
    .locals 0
    .parameter

    .prologue
    .line 21
    invoke-direct {p0}, Lcom/instagram/android/feed/a/a/d;->d()V

    return-void
.end method

.method private d()V
    .locals 5

    .prologue
    .line 82
    invoke-direct {p0}, Lcom/instagram/android/feed/a/a/d;->f()I

    move-result v0

    move v1, v0

    :goto_0
    invoke-direct {p0}, Lcom/instagram/android/feed/a/a/d;->g()I

    move-result v0

    if-gt v1, v0, :cond_2

    .line 84
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v0, v1}, Lcom/instagram/android/feed/a/a;->getItemViewType(I)I

    move-result v2

    .line 85
    invoke-direct {p0, v2}, Lcom/instagram/android/feed/a/a/d;->a(I)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 86
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v0, v1}, Lcom/instagram/android/feed/a/a;->getItem(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/j/l;

    .line 87
    invoke-virtual {v0}, Lcom/instagram/j/l;->c()Ljava/lang/String;

    move-result-object v3

    .line 88
    iget-object v4, p0, Lcom/instagram/android/feed/a/a/d;->e:Ljava/util/Map;

    invoke-interface {v4, v3}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z

    move-result v4

    if-nez v4, :cond_0

    .line 89
    invoke-direct {p0, v0, v1}, Lcom/instagram/android/feed/a/a/d;->a(Lcom/instagram/j/l;I)V

    .line 90
    iget-object v4, p0, Lcom/instagram/android/feed/a/a/d;->e:Ljava/util/Map;

    invoke-interface {v4, v3, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 93
    :cond_0
    invoke-direct {p0, v2}, Lcom/instagram/android/feed/a/a/d;->b(I)Z

    move-result v2

    if-nez v2, :cond_1

    .line 94
    iget-object v2, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v2, v1}, Lcom/instagram/android/feed/a/a;->b(I)Landroid/view/View;

    move-result-object v2

    .line 95
    if-eqz v2, :cond_1

    .line 96
    invoke-direct {p0, v2}, Lcom/instagram/android/feed/a/a/d;->a(Landroid/view/View;)I

    move-result v2

    iget v4, p0, Lcom/instagram/android/feed/a/a/d;->c:I

    if-lt v2, v4, :cond_1

    .line 97
    iget-object v2, p0, Lcom/instagram/android/feed/a/a/d;->f:Ljava/util/Map;

    invoke-interface {v2, v3}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_1

    .line 98
    invoke-direct {p0, v0, v1}, Lcom/instagram/android/feed/a/a/d;->b(Lcom/instagram/j/l;I)V

    .line 99
    iget-object v2, p0, Lcom/instagram/android/feed/a/a/d;->f:Ljava/util/Map;

    invoke-interface {v2, v3, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 83
    :cond_1
    add-int/lit8 v0, v1, 0x1

    move v1, v0

    goto :goto_0

    .line 106
    :cond_2
    return-void
.end method

.method private e()V
    .locals 6

    .prologue
    .line 109
    new-instance v2, Ljava/util/HashSet;

    invoke-direct {v2}, Ljava/util/HashSet;-><init>()V

    .line 110
    new-instance v3, Ljava/util/HashSet;

    invoke-direct {v3}, Ljava/util/HashSet;-><init>()V

    .line 112
    invoke-direct {p0}, Lcom/instagram/android/feed/a/a/d;->f()I

    move-result v0

    move v1, v0

    :goto_0
    invoke-direct {p0}, Lcom/instagram/android/feed/a/a/d;->g()I

    move-result v0

    if-gt v1, v0, :cond_1

    .line 114
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v0, v1}, Lcom/instagram/android/feed/a/a;->getItemViewType(I)I

    move-result v0

    .line 115
    invoke-direct {p0, v0}, Lcom/instagram/android/feed/a/a/d;->a(I)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 116
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v0, v1}, Lcom/instagram/android/feed/a/a;->getItem(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/j/l;

    .line 117
    invoke-virtual {v0}, Lcom/instagram/j/l;->c()Ljava/lang/String;

    move-result-object v4

    invoke-interface {v2, v4}, Ljava/util/Set;->add(Ljava/lang/Object;)Z

    .line 119
    iget-object v4, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v4, v1}, Lcom/instagram/android/feed/a/a;->b(I)Landroid/view/View;

    move-result-object v4

    .line 120
    if-eqz v4, :cond_0

    .line 121
    invoke-direct {p0, v4}, Lcom/instagram/android/feed/a/a/d;->a(Landroid/view/View;)I

    move-result v4

    iget v5, p0, Lcom/instagram/android/feed/a/a/d;->c:I

    if-lt v4, v5, :cond_0

    .line 122
    invoke-virtual {v0}, Lcom/instagram/j/l;->c()Ljava/lang/String;

    move-result-object v0

    invoke-interface {v3, v0}, Ljava/util/Set;->add(Ljava/lang/Object;)Z

    .line 113
    :cond_0
    add-int/lit8 v0, v1, 0x1

    move v1, v0

    goto :goto_0

    .line 128
    :cond_1
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->f:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->keySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .line 129
    :cond_2
    :goto_1
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_3

    .line 130
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    .line 131
    invoke-interface {v3, v0}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v4

    if-nez v4, :cond_2

    .line 132
    iget-object v4, p0, Lcom/instagram/android/feed/a/a/d;->f:Ljava/util/Map;

    invoke-interface {v4, v0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/j/l;

    invoke-direct {p0, v0}, Lcom/instagram/android/feed/a/a/d;->b(Lcom/instagram/j/l;)V

    .line 133
    invoke-interface {v1}, Ljava/util/Iterator;->remove()V

    goto :goto_1

    .line 137
    :cond_3
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->e:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->keySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .line 138
    :cond_4
    :goto_2
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_5

    .line 139
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    .line 140
    invoke-interface {v2, v0}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_4

    .line 141
    iget-object v3, p0, Lcom/instagram/android/feed/a/a/d;->e:Ljava/util/Map;

    invoke-interface {v3, v0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/j/l;

    invoke-direct {p0, v0}, Lcom/instagram/android/feed/a/a/d;->a(Lcom/instagram/j/l;)V

    .line 142
    invoke-interface {v1}, Ljava/util/Iterator;->remove()V

    goto :goto_2

    .line 145
    :cond_5
    return-void
.end method

.method private f()I
    .locals 2

    .prologue
    .line 185
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v0}, Lcom/instagram/android/feed/a/a;->e()Landroid/widget/ListView;

    move-result-object v0

    invoke-virtual {v0}, Landroid/widget/ListView;->getFirstVisiblePosition()I

    move-result v0

    const/4 v1, 0x0

    invoke-static {v0, v1}, Ljava/lang/Math;->max(II)I

    move-result v0

    return v0
.end method

.method private g()I
    .locals 2

    .prologue
    .line 189
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v0}, Lcom/instagram/android/feed/a/a;->e()Landroid/widget/ListView;

    move-result-object v0

    invoke-virtual {v0}, Landroid/widget/ListView;->getLastVisiblePosition()I

    move-result v0

    iget-object v1, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v1}, Lcom/instagram/android/feed/a/a;->getCount()I

    move-result v1

    add-int/lit8 v1, v1, -0x1

    invoke-static {v0, v1}, Ljava/lang/Math;->min(II)I

    move-result v0

    return v0
.end method


# virtual methods
.method public a()V
    .locals 2

    .prologue
    .line 44
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v0}, Lcom/instagram/android/feed/a/a;->o()Lcom/instagram/android/feed/a/i;

    move-result-object v0

    sget-object v1, Lcom/instagram/android/feed/a/i;->a:Lcom/instagram/android/feed/a/i;

    if-ne v0, v1, :cond_0

    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->a:Lcom/instagram/android/feed/a/a;

    invoke-virtual {v0}, Lcom/instagram/android/feed/a/a;->c()Lcom/instagram/android/fragment/d;

    move-result-object v0

    invoke-virtual {v0}, Lcom/instagram/android/fragment/d;->r()Z

    move-result v0

    if-nez v0, :cond_1

    .line 51
    :cond_0
    :goto_0
    return-void

    .line 49
    :cond_1
    invoke-direct {p0}, Lcom/instagram/android/feed/a/a/d;->e()V

    .line 50
    invoke-direct {p0}, Lcom/instagram/android/feed/a/a/d;->d()V

    goto :goto_0
.end method

.method public a(Lcom/instagram/android/feed/a/a/f;)V
    .locals 1
    .parameter

    .prologue
    .line 148
    iget-object v0, p0, Lcom/instagram/android/feed/a/a/d;->d:Ljava/util/Set;

    invoke-interface {v0, p1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z

    .line 149
    return-void
.end method

.method public b()V
    .locals 0

    .prologue
    .line 78
    invoke-direct {p0}, Lcom/instagram/android/feed/a/a/d;->c()V

    .line 79
    return-void
.end method

.method public onChanged()V
    .locals 0

    .prologue
    .line 67
    invoke-direct {p0}, Lcom/instagram/android/feed/a/a/d;->c()V

    .line 68
    invoke-super {p0}, Landroid/database/DataSetObserver;->onChanged()V

    .line 69
    return-void
.end method

.method public onInvalidated()V
    .locals 0

    .prologue
    .line 73
    invoke-direct {p0}, Lcom/instagram/android/feed/a/a/d;->c()V

    .line 74
    invoke-super {p0}, Landroid/database/DataSetObserver;->onInvalidated()V

    .line 75
    return-void
.end method
